package top.yunjianwang.command;

import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import top.yunjianwang.event.MyEventHandler;

import java.util.HashSet;
import java.util.Set;

public class WhiteList implements CommandExecutor {
    private Set<String> Whitelist;

    public WhiteList(MyEventHandler handler) {
        this.Whitelist = handler.getWhiteList();
    }


    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        // 判断arg数量
        if (args.length == 1) {
            this.Whitelist.add(args[0]);
            sender.getServer().broadcastMessage("Give" + ChatColor.AQUA + args[0] + ChatColor.WHITE + "Operation");
            return true;
        }
        return false;
    }
}
